package com.qili.service.jc.impl;

import com.qili.base.mapper.BaseMapper;
import com.qili.base.service.impl.BaseServiceImpl;
import com.qili.entity.jc.JcProjectMilepost;
import com.qili.entity.jc.JcProjectStage;
import com.qili.entity.jc.dto.JcProjectMilepostDTO;
import com.qili.mapper.jc.JcProjectMilepostMapper;
import com.qili.service.jc.JcProjectMilepostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author zhaoyongke
 * @date 2020/11/3
 * @description
 */
@Service
public class JcProjectMilepostServiceImpl extends BaseServiceImpl<JcProjectMilepost,String> implements JcProjectMilepostService {

    @Autowired
    private JcProjectMilepostMapper jcProjectMilepostMapper;
    @Override
    public BaseMapper<JcProjectMilepost, String> getMappser() {
        return jcProjectMilepostMapper;
    }

    @Override
    public List<JcProjectMilepostDTO> selectProjectmilepost(JcProjectMilepostDTO dto) {
        List<JcProjectMilepostDTO>  list=  jcProjectMilepostMapper.selectProjectmilepost(dto);
        return  list;
    }

    @Override
    public List<JcProjectMilepost> getFinishedMilepost(JcProjectMilepost milepost) {
        Example example = new Example(JcProjectMilepost.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("ProjectId",milepost.getProjectId());
        criteria.andEqualTo("supervisorProjectStageId",milepost.getSupervisorProjectStageId());
        criteria.andEqualTo("finishStatus","2");
        Example.Criteria criteria1 = example.createCriteria();
        criteria1.orEqualTo("id",milepost.getId());
        example.or(criteria1);
        return jcProjectMilepostMapper.selectByExample(example);
    }

    @Override
    public int deleteByProjectIds(String[] ids) {
        return jcProjectMilepostMapper.deleteByProjectIds(ids);
    }

    @Override
    public String getFinishedMilepostProgress(JcProjectStage stage) {
        return jcProjectMilepostMapper.getFinishedMilepostProgress(stage);
    }

    @Override
    public String getFinishedMilepostProgress(JcProjectMilepost milepost) {
        return jcProjectMilepostMapper.getFinishedMilepostProgressWith(milepost);
    }
/*    @Override
    public int insert(JcProjectMilepost supervisorProjectMilepost) {

        return supervisorProjectMilepostMapper.insert(supervisorProjectMilepost);
    }*/

    @Override
   public  List<JcProjectMilepostDTO> selectMilePostOrder(JcProjectMilepostDTO dto){
        List<JcProjectMilepostDTO>  listMipost=jcProjectMilepostMapper.selectMilePostOrder(dto);
        return listMipost;

    }
}
